<template>
	<view class="content">
		<view class="flex1">
			<homeIndex class="wh100"  v-if="index=='0'" ref="homeIndex"></homeIndex>
			<meIndex class="wh100"  v-if="index=='1'" ref="meIndex"></meIndex>
		</view>
		<u-tabbar :value="index" @change="select" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true">
			<u-tabbar-item text="首页" name="0" icon="home"></u-tabbar-item>
			<u-tabbar-item text="我的" name="1" icon="account"></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import homeIndex from '@/components/home/index.vue';
	import meIndex from '@/components/me/index.vue';
	export default {
		data() {
			return {
				//当前选中
				index: "0",
				//主键key
				hackReset :true,
			}
		},
		components: {
			homeIndex: homeIndex,
			meIndex: meIndex
		},
		computed: {

		},
		onShow(data){
			if(this.index==0){
				//刷新
				this.$refs.homeIndex.refresh();
			}
		},
		methods: {
			select(index) {
				this.index = index;
			}
		}
	}
</script>



<style lang="scss">
	.content {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}

	

	.select {
		color: #00aa00;
		text-align: center;
	}

	.u-tabbar {
		flex: 0 !important;
	}

	.no_select {
		text-align: center;
	}
</style>
